﻿CREATE TABLE [dbo].[ew_tbl_selection_items]
(
    [ew_uid_selection_item_id] UNIQUEIDENTIFIER NOT NULL, 
    [ew_vc_key] VARCHAR(512) NOT NULL, 
    [ew_xml_value] XML([dbo].[ew_xsdc_text]) NOT NULL, 
    [ew_uid_selection_id] UNIQUEIDENTIFIER NOT NULL, 
    [ew_dt_created] DATETIME NOT NULL, 
    [ew_nvc_created_by] NVARCHAR(1024) NOT NULL, 
    [ew_dt_modified] DATETIME NOT NULL, 
    [ew_nvc_modified_by] NVARCHAR(1024) NOT NULL, 
    [ew_t_timestamp] TIMESTAMP NOT NULL, 
    CONSTRAINT [ew_pk_tbl_selection_items] PRIMARY KEY ([ew_uid_selection_item_id]), 
    CONSTRAINT [ew_fk_tbl_selection_items_selections] FOREIGN KEY ([ew_uid_selection_id]) REFERENCES [ew_tbl_selections]([ew_uid_selection_id]) 
)

GO

CREATE UNIQUE INDEX [ew_uk_tbl_selection_items_key] ON [dbo].[ew_tbl_selection_items] ([ew_vc_key], [ew_uid_selection_id])
